setTimeout(function(){
	$("#sysUserName").val('')
	$("#sysUserName").focus();
	$("#sysUserName").rules("add",{
		remote: {
			url: 'sys/users/checkName'+($("#sysUserName").val()+""),
			type: "get",
			dataType: "json", 
			dataFilter:function(data,type){
				return data=="false"?false:true;
			}
		}, 
		messages: {remote: "该用户名已注册"}
	});  
} , parseInt(Math.random() * 1000)); 

var app = angular.module('userApp', []);
app.controller('userController', function($scope, $http) {
	$scope.user;
	
	$scope.refreshData=function(){
		$scope.user={};
	}
	
	$scope.userSave=function(){
	   if($("#myForm").valid()){
		   $http.post('sys/users/add/', $scope.user).success(function(response){
			   $scope.msg=response.meta;
			   if($scope.msg.message != "ok") {
				   $('#box-msg').modal({
	    	    		show: true
	    	    	});
			   }else {
				   redirectUrl("manage/user/","list.jsp");
			   }
           });
	   }
	}
	
	$scope.userReset=function(){
		$scope.user={};
	}
	
	$scope.userCancle=function(){
		redirectUrl("manage/user/","list.jsp");
	}
});